export const ERROR_CODE = {
    // 用户身份过期
    VERIFY_EXPIRE: 401,
    // 验证码错误
    CODE_FAIL: 10001,
    WECHAT_MINI_PROGRAM_CODE_FAIL: 10002,
    // 更新失败
    UPDATE_FAIL: 20001,
    // 更新失败
    INTERNAL_FAIL: 30001,
    // INVALID_INPUT: 400,
    // UNAUTHORIZED: 401,
    // FORBIDDEN: 403,
    // NOT_FOUND: 404,
    // INTERNAL_SERVER_ERROR: 500,
    GOODS_NOT_FOUND: 40001,
    PAY_ORDER_NOT_FOUND: 40002,
    GOODS_NOT_REPEATABLE_PURCHASE: 40003,
    VIP_USAGE_COUNT_REACH_LIMIT: 40004,
    SUCCESS: 0,
    INVALID_INPUT: 400,
    NOT_FOUND: 404,
    INTERNAL_ERROR: 500,
};

export const ERROR_MESSAGE = {
    [ERROR_CODE.VERIFY_EXPIRE]: '用户身份过期',
    [ERROR_CODE.CODE_FAIL]: '验证码错误',
    [ERROR_CODE.WECHAT_MINI_PROGRAM_CODE_FAIL]: '微信小程序验证码错误',
    [ERROR_CODE.UPDATE_FAIL]: '更新失败',
    [ERROR_CODE.INTERNAL_FAIL]: '稍等嗷，让我再想想～',
    // [ERROR_CODE.INVALID_INPUT]: 'INVALID_INPUT',
    // [ERROR_CODE.UNAUTHORIZED]: 'UNAUTHORIZED',
    // [ERROR_CODE.FORBIDDEN]: 'FORBIDDEN',
    // [ERROR_CODE.NOT_FOUND]: 'NOT_FOUND',
    // [ERROR_CODE.INTERNAL_SERVER_ERROR]: 'INTERNAL_SERVER_ERROR',
    [ERROR_CODE.GOODS_NOT_FOUND]: '商品不存在，请刷新重试~',
    [ERROR_CODE.PAY_ORDER_NOT_FOUND]: '订单不存在',
    [ERROR_CODE.GOODS_NOT_REPEATABLE_PURCHASE]: '您已购买该商品，请勿重复购买~',
    [ERROR_CODE.VIP_USAGE_COUNT_REACH_LIMIT]: '您的体验次数已经用完, 请充值vip~',
    [ERROR_CODE.SUCCESS]: 'success',
    [ERROR_CODE.INVALID_INPUT]: '输入参数错误',
    [ERROR_CODE.NOT_FOUND]: '未找到相关数据',
    [ERROR_CODE.INTERNAL_ERROR]: '服务器内部错误',
};

// 定义一个方法返通用 response 格式
export const getResponse = (code, message, data) => {
    return {
        code,
        message,
        data,
    };
};

export const SUCCESS_CODE = {
    SUCCESS: 0,
};

export const SUCCESS_MESSAGE = {
    SUCCESS: "SUCCESS"
}


export const WEATHER_TYPE = {
    // 晴天
    SUNNY: 'sunny',
    // 多云
    CLOUDY: 'cloudy',
    // 阴天
    CLOUDYDAY: 'cloudyday',
    // 小雨
    LIGHTRAIN: 'lightrain',
    // 中雨
    MODERRATERAIN: 'moderaterain',
    // 大雨
    HEAVYRAIN: 'heavyrain',
    // 雷阵雨
    THUNDERSHOWERS: 'thundershowers',
    // 雪天
    SNOWDAY: 'snowday',
    // 雾天
    FOGGYDAY: 'foggyday',
    // 大风
    STRONGWIND: 'strongwind',
    // 夜晚晴
    CLEARNIGHT: 'clearnight',
    // 夜晚多雨
    NIGHTRAIN: 'nightrain',
}


export const ORDER_STATUS = {
    INIT: "INIT",
    SUCCEED: "SUCCEED",
    FAILED: "FAILED",
    CLOSED: "CLOSED",
    PARTIALLY_REFUNDED: "PARTIALLY_REFUNDED",
    REFUNDED: "REFUNDED"
}


export const ORDER_STATUS_DESC = {
    [ORDER_STATUS.INIT]: "待支付",
    [ORDER_STATUS.SUCCEED]: "支付成功",
    [ORDER_STATUS.FAILED]: "支付失败",
    [ORDER_STATUS.CLOSED]: "订单已关闭",
    [ORDER_STATUS.PARTIALLY_REFUNDED]: "已部分退款",
    [ORDER_STATUS.REFUNDED]: "已全额退款"
}


export const PAY_NOTIFY_TYPE = {
    ORDER_SUCCEED: "ORDER.SUCCEED",
    ORDER_FAILED: "ORDER.FAILED",
    ORDER_CANCEL: "ORDER.CANCEL",
    ORDER_CLOSED: "ORDER.CLOSED",
    REFUND_SUCCEED: "REFUND.SUCCEED",
    REFUND_FAILED: "REFUND.FAILED"
}


export const PAY_NOTIFY_TYPE_DESC = {
    [PAY_NOTIFY_TYPE.ORDER_SUCCEED]: "订单支付成功",
    [PAY_NOTIFY_TYPE.ORDER_FAILED]: "订单支付失败",
    [PAY_NOTIFY_TYPE.ORDER_CANCEL]: "订单取消",
    [PAY_NOTIFY_TYPE.ORDER_CLOSED]: "订单关闭",
    [PAY_NOTIFY_TYPE.REFUND_SUCCEED]: "退款成功",
    [PAY_NOTIFY_TYPE.REFUND_FAILED]: "退款失败"
}


export const DURATION_UNIT = {
    DAY: "day",
    MONTH: "month",
    YEAR: "year"
}

export const SECONDS_ONE_MINUTE = 60
export const SECONDS_ONE_HOUR = 60 * SECONDS_ONE_MINUTE
export const SECONDS_ONE_DAY = 24 * SECONDS_ONE_HOUR
export const SECONDS_ONE_MONTH = 30 * SECONDS_ONE_DAY
export const SECONDS_ONE_YEAR = 365 * SECONDS_ONE_MONTH

// 非 vip 用户功能次数限制
export const NonVipDiaryBillLimit = 10
export const NonVipDiaryLimit = 10
export const NonVipAiChatLimit = 10
